package org.springblade.modules.policy.excel;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.modules.enterprise.excel.LocalDateTimeConverter;
import org.springblade.modules.policy.entity.Policy;
import org.springblade.modules.policy.entity.PolicyDraw;
import org.springblade.modules.policy.service.IPolicyService;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class PolicyDrawExcel implements Serializable {
	private static final long serialVersionUID = 1L;
	/**
	 * 事项名称
	 */
	@ExcelProperty("事项名称")
	private String name;
	/**
	 * 相关政策
	 */
	@ExcelProperty("相关政策")
	private String policy;
	/**
	 * 申报条件
	 */
	@ExcelProperty("申报条件")
	private String acceptCondition;
	/**
	 * 优惠内容
	 */
	@ExcelProperty("优惠内容")
	private String subsidyStandards;
	/**
	 * 申请材料
	 */
	@ExcelProperty("申请材料")
	private String material;
	/**
	 * 来源信息批次
	 */
	@ExcelProperty("来源信息批次")
	private String sourceBatch;
	/**
	 * 来源信息条目
	 */
	@ExcelProperty("来源信息条目")
	private String sourceEntry;
	/**
	 * 咨询电话
	 */
	@ExcelProperty("咨询电话")
	private String telephone;
	/**
	 * 主管部门
	 */
	@ExcelProperty("主管部门")
	private String implemention;
	/**
	 * 办结时限
	 */
	@ExcelProperty("办结时限")
	private Integer completionTime;
	/**
	 * 申报时间开始日期
	 */
	@DateTimeFormat(
		pattern = "yyyy-MM-dd"
	)
	@JsonFormat(
		pattern = "yyyy-MM-dd"
	)
	@ExcelProperty(value = "申报时间开始日期")
	private Date declareStart;
	/**
	 * 申报时间截至日期
	 */
	@ExcelProperty("申报时间截至日期")
	private String declareEnd;

	public PolicyDrawExcel(PolicyDraw policyDraw) {
		this.name = policyDraw.getName();
		this.policy = policyDraw.getPolicys();
		this.acceptCondition = policyDraw.getAcceptCondition();
		this.subsidyStandards = policyDraw.getSubsidyStandards();
		this.sourceEntry = policyDraw.getSourceEntry();
		this.sourceBatch = policyDraw.getSourceBatch();
		this.telephone = policyDraw.getTelephone();
		this.implemention = policyDraw.getImplemention();
		this.completionTime = policyDraw.getCompletionTime();
		this.declareStart = policyDraw.getDeclareStart();
		this.declareEnd = policyDraw.getDeclareEnd();
	}
}
